All Questions
Tagged with scriptingcommand-line
137 questions
6votes
4answers
577views
get chain of users created by chaining su calls
While administrating a linux server (a Debian server, for instance), I often switch users. Sometimes, I will chain multiple user switches together: aluriak$ sudo -s root$ […] root$ su aluriak aluriak$ ...
0votes
2answers
205views
Command-line tool enabling tagging and related tags functionality
Is there a command-line tool that enables to give a file more attributes than a name? For example, we have a file called ubuntu.pdf and we give it tags like command-line, shell, nautilus, ...
0votes
0answers
36views
How to properly format the command argument for sudo? [duplicate]
I have a command that is similar to this minimal example: $ sh -c 'echo "1=$1"' _ foo 1=foo $ When I want to run it through sudo, it stops working: $ sudo -i -u user -- sh -c 'echo "1=...
0votes
1answer
243views
Zsh script to recursively unrar into a folder with the same name [duplicate]
Is it possible to use a zsh script to unrar all directories within another directory? As follows: dir |_dir1.rar |_dir2.rar |_dir3.rar I would like the command not to include the cd. I will cd into ...
0votes
1answer
29views
how to insert audio from video A into video B (no audio)?
Id like to create a video C with audio from video A but video from video B. Video A and video B have nearly the same length in seconds. Since the videos are a couple GBs, I guess it would be slower if ...
1vote
3answers
129views
Passing directory names into a bash command individually [duplicate]
I have the following directory names: /aaa /bbb /ccc /ddd And I want to run the following command passing in the directory names with just ls: ls | composer show drupal/MY_DIRECTORY_NAME_HERE --...
0votes
1answer
211views
Remove certain words and set word at end of string in files
I have a bunch of files that contain strings similar to: Get<1>(abc) Get<2>(xyz) How can I recursively search for all files with the above pattern and remove everything before the first '(...
0votes
0answers
249views
Zip files according to quarterly year
I have folders sorted according to the date from the past 5 years. I'm looking for ideas on a script or a way to zip all the files according to the quarter year to save my disk space. For example, I ...
1vote
1answer
364views
TShark pcap filter command possibly simplified?
Object: to find the IP addresses of HTTP servers in a pcap file with a specific header string. Can or should the -l option to flush be used? One way: the following was done but am wondering if it can ...
0votes
0answers
2kviews
How to add files to bootable linux setup ISO image copied to USB flash drive?
I use dd bs=4M if=debian-11.0.0-amd64-netinst.iso of=/dev/sdc conv=fdatasync status=progress && sync to write the debian-11.0.0-amd64-netinst.iso ISO file to my USB flash drive and then I can ...
0votes
0answers
362views
Monitoring file change sequenes with Inotifywait
Currently I am monitoring the files by using above code, it works as expected. Basically I am monitoring the opened text files and executing commands. inotifywait -m -q /home/TestDirectory | while ...
1vote
2answers
3kviews
Is it possible to create a temporary file that will autodelete after a specific time that it's not read by any other program?
I'd like to create a temporary file that will be read by multiple scripts after its creation, but I don't have an easy way of monitoring when the last script finishes reading this temporary file to ...
0votes
4answers
837views
Bash: convert 100,000+ characters to decimal format?
I'm looking for a quick and not-so CPU intensive solution to convert 100,000+ lines of text into decimal format. # random ascii string='QPWOEIRUTYALSKDJFHGZMXNCBV,./;[]75498053$#!@*&^%(*' convert ...
0votes
2answers
405views
shell script relative position from the file
I have almost no idea about shell scripts or commands in linux I have a project named projectx projectX happens to be in users/hardik/desktop/projectx I have created a shell script start.sh. This is ...
0votes
2answers
1kviews
Error while reading File with Bash
I want to read a File in a bash script with the following code: #!/bin/bash file=$(sort "$1" | cut -f 1 -d "," | uniq -c | sed 's/^ *//g') while IFS= read -r line do echo &...